package tools;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import junit.framework.JUnit4TestAdapter;

import org.junit.Before;
import org.junit.Test;

import datatypes.Vertex;

public class Tool_test {
	
	public static junit.framework.Test suite() {
		return new JUnit4TestAdapter(Tool_test.class);
	}

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void test_computeLineIntersectionPoint() {
		fail("Not yet implemented");
	}

	@Test
	public void test_leftOfTest() {
		Vertex p = new Vertex(0.0, 0.0);
		Vertex q = new Vertex(2.0, 2.0);
		Vertex r = new Vertex(0.0, 1.0);
		assertTrue("Vertex r should be to the left of p->q.", 0 < Tool.leftOfTest(p, q, r));
		r = new Vertex(1.0, 0.0);
		assertTrue("Vertex r should be to the right of p->q.", 0 > Tool.leftOfTest(p, q, r));
		r = new Vertex(1.0, 1.0);
		assertEquals("Vertex r should be on the edge p->q.", 0.0, Tool.leftOfTest(p, q, r), 0.0000001);
	}

}
